package com.design.strategy;

import com.design.util.XMLUtil;

/**
 * @author leali
 * @title: Client
 * @projectName design
 * @description: 策略
 * @date 2021/12/31 22:48
 */
public class Client {
    public static void main(String[] args) {
        MovieTicket mt = new MovieTicket();
        double originalPrice = 60.0;
        double currentPrice;

        mt.setPrice(originalPrice);
        System.out.println("原始价为：" + originalPrice);
        System.out.println("---------------------------------");

        Discount discount;
        discount = (Discount) XMLUtil.getValueByTagName("strategyName", 0, true);
        //注入折扣对象
        mt.setDiscount(discount);

        currentPrice = mt.getPrice();
        System.out.println("折后价为：" + currentPrice);
    }
}
